平常都不是從無到有的刻投影片,而是直接開起來修改,所以我到現在才知道,平常拿來當作封面標題的,居然是「章節標題」
placeholders
的說明是 Instance of SlidePlaceholders containing sequence of placeholder shapes in this slide.
shapes
的說明是 Instance of SlideShapes containing sequence of shape objects appearing on this slide.
from pptx import Presentation
# 讀進樣板
f = open('材料組進度報告 - 樣板.pptx', 'rb')
prs = Presentation(f)
f.close()
for template in prs.slide_layouts:
# Insert this slide layout into the presentation
slide = prs.slides.add_slide(template)
# Find out shapes in this slide
shape_count = 0
for shape in slide.shapes:
# Find out text in this shape
if shape.has_text_frame:
# Find out text in this text frame
shape.text = str(shape_count)
shape_count += 1
prs.save('樣板標記.pptx')